package me.xue.communityhealth.repo;

import me.xue.communityhealth.model.DrugSupplier;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface DrugSupplierRepository {

    @Insert("INSERT INTO `drug_supplier`(name,detail) VALUES(#{name},#{detail})")
    int save(DrugSupplier drugSupplier);

    @Update("UPDATE `drug_supplier` SET name=#{name},detail=#{detail} WHERE id=#{id}")
    int update(DrugSupplier drugSupplier);

    @Delete("DELETE FROM `drug_supplier` WHERE id=#{id}")
    int delete(Integer id);

    @Select("SELECT * FROM `drug_supplier` WHERE id=#{id}")
    DrugSupplier findOne(Integer id);

    @Select("SELECT * FROM `drug_supplier`")
    List<DrugSupplier> findAll();

}
